<?php
include('pages/config.php');
session_start();

if(!session_is_registered('myusername')) {
	header("Location: index.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--<meta http-equiv="X-UA-Compatible" content="IE=8" />-->

<title>MochaUI - A Web Applications User Interface Library</title>
<meta name="description" content="A web applications user interface library built on the Mootools javascript framework" />

<link rel="stylesheet" href="css/content.css" type="text/css" />
<link rel="stylesheet" href="css/ui.css" type="text/css" />
<link rel="stylesheet" href="css/custom.css" type="text/css" />
	
<!--[if IE]>
	<script type="text/javascript" src="scripts/excanvas-compressed.js"></script>		
<![endif]-->

<script type="text/javascript" src="scripts/mootools-1.2-core.js"></script>
<script type="text/javascript" src="scripts/mootools-1.2-more.js"></script>	
<script type="text/javascript" src="scripts/metaswitch.js"></script>	

<!--
	mocha.js.php is for development. It is not recommended for production.
	For production it is recommended that you used a compressed version of either
	the output from mocha.js.php or mocha.js. You could also list the
	necessary source files individually here in the header though that will
	create a lot more http requests than a single concatenated file.
		
<script type="text/javascript" src="scripts/mocha.js"></script>

-->
<script type="text/javascript" src="scripts/source/Utilities/mocha.js.php"></script>

<script type="text/javascript" src="scripts/mocha-init.js"></script>

<!-- This will also keep the users session active until they log out -->
<script type="text/javascript" src="plugins/digitalclock/scripts/digitalclock.js"></script>

</head>
<body>

<div id="desktop">

<div id="desktopHeader">
<div id="desktopTitlebarWrapper">
	<div id="desktopTitlebar">
		<h1 class="applicationTitle">Mocha UI</h1>
		<h2 class="tagline">A Web Applications <span class="taglineEm">User Interface Library</span></h2>
		<div id="topNav">
			<ul class="menu-right">
				<li>Welcome <a id="userProfileWindow" href=""><?php echo $_SESSION['myusername'];?></a>.</li>
				<li><a href="pages/logout.php">Sign Out</a></li>
			</ul>
		</div>
	</div>
</div>
	
<div id="desktopNavbar">
	<ul>
		<li><a href="main.php">Home</a></li>
		<li><a class="returnFalse" href="">Logs</a>
			<ul>
				<li><a id="metaswitchLogLinkCheck" href="metaswitch/metaswitchLog.php">MetaSwitch Log</a></li>
				<li><a id="userCommandLog" href="pages/commandLog.php">Occam Log</a></li>
			</ul>
		</li>
		<li><a class="returnFalse" href="">Tools</a>
			<ul>
				<li><a id="eqnLookupLinkCheck" href="pages/eqn-lookup.php">IP Lookup</a></li>
				<li><a id="occamSearchLinkCheck" href="pages/occam_search.php">Occam Search</a></li>
			</ul>
		</li>
		<?php if ($_SESSION['access_level'] >= 4) {
		// If the user has Manager or higher rights, display Manager menu?>
		<li><a class="returnFalse" href="">Manager</a>
			<ul>
				<li><a id="viewMetaUserLogLinkCheck" href="metaswitch/viewMetaLog.php">Meta Log</a></li>
				<li><a id="viewUserLogLinkCheck" href="pages/viewUserLog.php">Occam Log</a></li>
			</ul>
		</li>
		<?php } ?>
		<?php if ($_SESSION['access_level'] == 5) {
		// If the user is and Admin, then display the Admin menu?>
		<li><a class="returnFalse" href=\"\">Admin</a>
			<ul>
				<li><a id="addUserLinkCheck" href="pages/addUser.php">Add User</a></li>
				<li><a id="editUser" href="pages/editUser.php">Edit User</a></li>
				<li><a id="viewUserLinkCheck" href="pages/viewUser.php">View User</a></li>
				<li><a id="deleteUser" href="pages/deleteUser.php">Remove User</a></li>
				<li class="divider"><a id="addDeviceLinkCheck" href="pages/addDevice.php">Add Occam Device</a></li>
				<li><a id="deleteDeviceLinkCheck" href="pages/deleteDevice.php">Remove Occam Device</a></li>
				<li><a id="occamManagementLinkCheck" href="pages/occamManagement.php">Occam Management</a></li>
				<li class="divider"><a id="viewFaultyDevicesLinkCheck" href="pages/viewFaultyDevices.php">Faulty Devices</a></li>
				<li><a id="viewFaultySTBLinkCheck" href="pages/viewFaultySTB.php">Faulty STBs</a></li>
				<li><a id="viewFaultyModemLinkCheck" href="pages/viewFaultyModem.php">Faulty Modems</a></li>
			</ul>
		</li>
		<?php }?>
	</ul>	
<div class="toolbox divider2">
	<div id="spinnerWrapper"><div id="spinner"></div></div>		
</div>

<div class="toolbox divider2">
	<img title="User Settings" src="images/icons/cog.gif" onclick="MochaUI.notification('Do Something');" width="16" height="16" alt="" />
	<img src="images/icons/windows.gif" onclick="MochaUI.notification('Do Something');" width="16" height="16" alt="" />
	<?php if ($_SESSION['access_level'] == 5) {
	//  If the user is an Admin, then display the Administration window?>
		<img id="adminWindow" title="" src="images/icons/sheet.gif" width="16" height="16" alt="" />
	<?php }?>
</div>

<div class="toolbox divider2">
	<!-- TODO: Implement a working clock to keep session active-->
	<!-- TODO: Make the clock configurable for each user-->
	<div id="timeWrapper"><div style="color: #f6f6f6" id="currentTime"></div></div>
</div>	
	
</div><!-- desktopNavbar end -->
</div><!-- desktopHeader end -->

<div id="dockWrapper">
	<div id="dock">
		<div id="dockPlacement"></div>
		<div id="dockAutoHide"></div>
		<div id="dockSort"><div id="dockClear" class="clear"></div></div>
	</div>
</div>

<div id="pageWrapper"></div>

<div id="desktopFooterWrapper">
	<div id="desktopFooter">
		Version 0.1
		<!-- &copy; 2007-2008 <a target="_blank" href="http://greghoustondesign.com/">Greg Houston</a> - MIT License-->
	</div>
</div>

</div><!-- desktop end -->

</body>
</html>
